<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/protected/templates/loggedtemplate.xhtml">

	<ui:define name="right">		
			
			<h:form>
				<h:outputLabel value="#{msg.oneDayEmailForecast}" for="forecastCheckbox"/>
				<h:selectBooleanCheckbox id="forecastCheckbox" value="#{notificationBean.position.forecast}" binding="#{positionForecastCheckbox.positionForecastCheckbox}" valueChangeListener="#{positionForecastCheckboxListener.positionForecastCheckboxChanged()}" onchange="submit();" />
			</h:form><br/>
			<h:outputText value="#{msg.userNotification} #{notificationBean.position.name}:" /><br/><br/>
			<ui:repeat var="notification" value="#{notificationBean.notifications}">
				<h:form>
					<h:graphicImage value="../Image?name=#{notification.type}" />					
					<h:outputText value="#{notification}">
						<f:converter converterId="NotificationConverter"/>
					</h:outputText>					
					<input type="hidden" value="#{notification.id}" name="deleteID" />
					<h:commandLink value="#{msg.delete}" action="#{notificationAction.deleteNotification()}"/>
				</h:form>				
			</ui:repeat>
	</ui:define>
	
	<ui:define name="text">
			<h:form>
				<h:outputLabel value="#{msg.notificationMsg}" for="message" />
				<h:inputText id="message" value="#{notificationBean.message}" />
				
				<h:panelGrid columns="3">				
				
				<h:outputLabel value="#{msg.notificationMinTemp}" for="minTempInput" />
				<h:inputText id="minTempInput" binding="#{notificationInput.minTempInput}" value="#{notificationBean.mintemp}" label="#{msg.notificationMinTemp}" disabled="true" size="3">
					<f:validateLongRange minimum="-60" maximum="60" />
				</h:inputText>
				<h:selectBooleanCheckbox id="minTempCheckbox"  binding="#{notificationCheckbox.minTempCheckbox}" valueChangeListener="#{notificationCheckboxListener.minTempCheckboxChanged()}" onchange="submit();" immediate="true" />
				
				<h:outputLabel value="#{msg.notificationMaxTemp}" for="maxTempInput" />
				<h:inputText id="maxTempInput" binding="#{notificationInput.maxTempInput}" value="#{notificationBean.maxtemp}"  label="#{msg.notificationMaxTemp}" disabled="true" size="3">
					<f:validateLongRange minimum="-60" maximum="60" />
				</h:inputText>
				<h:selectBooleanCheckbox id="maxTempCheckbox"  binding="#{notificationCheckbox.maxTempCheckbox}" valueChangeListener="#{notificationCheckboxListener.maxTempCheckboxChanged()}" onchange="submit();" immediate="true" />
				
				<h:outputLabel value="#{msg.notificationMinPressure}" for="minPressureInput" />				
				<h:inputText id="minPressureInput" binding="#{notificationInput.minPressureInput}" value="#{notificationBean.minpressure}"  label="#{msg.notificationMinPressure}" disabled="true" size="3">
					<f:validateLongRange minimum="900" maximum="1100" />
				</h:inputText>
				<h:selectBooleanCheckbox id="minPressureCheckbox"  binding="#{notificationCheckbox.minPressureCheckbox}" valueChangeListener="#{notificationCheckboxListener.minPressureCheckboxChanged()}" onchange="submit();" immediate="true" />
				
				<h:outputLabel value="#{msg.notificationMaxPressure}" for="maxPressureInput" />			
				<h:inputText id="maxPressureInput" binding="#{notificationInput.maxPressureInput}" value="#{notificationBean.maxpressure}"  label="#{msg.notificationMaxPressure}" disabled="true" size="3">
					<f:validateLongRange minimum="900" maximum="1100" />
				</h:inputText>				
				<h:selectBooleanCheckbox id="maxPressureCheckbox"  binding="#{notificationCheckbox.maxPressureCheckbox}" valueChangeListener="#{notificationCheckboxListener.maxPressureCheckboxChanged()}" onchange="submit();" immediate="true" />				
				</h:panelGrid>
				<h:outputText value="#{msg.aura}" />	
				
				<h:selectOneRadio id="typeRadio" value="#{notificationBean.type}" required="true" requiredMessage="#{msg.chooseConditions}">

				  	<f:selectItem itemValue="-65" itemLabel="#{msg.notDefine}" />
				   	<f:selectItem itemValue="0" itemLabel="#{msg.sunny}" />
				   	<f:selectItem itemValue="1" itemLabel="#{msg.lightCloudy}" />
				   	<f:selectItem itemValue="2" itemLabel="#{msg.cloudy}" />
				   	<f:selectItem itemValue="4" itemLabel="#{msg.rain}" />
				   	<f:selectItem itemValue="5" itemLabel="#{msg.snow}" />
				
				</h:selectOneRadio>
				
				<h:outputText value="#{msg.oneTime}" /><h:selectBooleanCheckbox id="oneTimeCheckbox"  binding="#{notificationOneTimeCheckbox.oneTimeCheckbox}" /><br/>
				<h:commandButton action="#{notificationAction.addNotification()}" value="#{msg.newNotificationButton}" />				
			</h:form>
			
			<h:message for="minTempInput"/><br/>
			<h:message for="maxTempInput"/><br/>
			<h:message for="minPressureInput"/><br/>
			<h:message for="maxPressureInput"/><br/>
	</ui:define>
	
</ui:composition>
</html>